<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Admin extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('file');
        $this->load->helper('fuc');
        $this->load->library('topclass');
        $this->load->database();
        $this->config->load('topapiconfig');
        $this->load->model('cats_product');
    }

    public function index() {
        $this->load->view('welcome_message');
    }

    public function item_list() {
        print_r($_POST);
        $tt = $this->cats_product->get_items_byPost();
        $data["items_array"] = $this->cats_product->get_items();
        $data["items_types"] = $this->cats_product->get_items_types();
        $data["cats_types"] = $this->cats_product->get_cats();
        // print_r($data["items_array"]);
        $this->load->view('admin/items_list', $data);
        //   echo "asdasd";
    }

    public function item_deatil() {
        echo $id = get_segment_fuc(4);
        $data["item_detail_array"] = $this->cats_product->get_itemsdetail($id);
        $data["items_types"] = $this->cats_product->get_items_types();
        $data["cats_types"] = $this->cats_product->get_cats();
        print_r($data["item_detail_array"]);
        $this->load->view('admin/items_detail', $data);
       
    }

    public function change_item_info() {
        print_r($_POST);
        echo $updatesql = "update prores set itemname=\"{$_POST["itemname"]}\"
, itemurl=\"{$_POST["itemurl"]}\",type=\"{$_POST["type"]}\",clickcounts=\"{$_POST["clickcounts"]}\",catid=\"{$_POST["catid"]}\",imgurl=\"{$_POST["imgurl"]}\",isdisplay=\"{$_POST["isdisplay"]}\" where id=\"{$_POST["id"]}\"";
        $this->db->query($updatesql);
        redirect('admin/admin/item_list/', 'refresh');

    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */